/*
 * Copyright (c) 2018 Tencent. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
const AbstractModel = require("../../common/abstract_model");

/**
 * DescribeQueueDetail response structure.
 * @class
 */
class DescribeQueueDetailResponse extends  AbstractModel {
    constructor(){
        super();

        /**
         * Total number of queues
         * @type {number || null}
         */
        this.TotalCount = null;

        /**
         * Queue list
         * @type {Array.<QueueSet> || null}
         */
        this.QueueSet = null;

        /**
         * The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.
         * @type {string || null}
         */
        this.RequestId = null;

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }
        this.TotalCount = 'TotalCount' in params ? params.TotalCount : null;

        if (params.QueueSet) {
            this.QueueSet = new Array();
            for (let z in params.QueueSet) {
                let obj = new QueueSet();
                obj.deserialize(params.QueueSet[z]);
                this.QueueSet.push(obj);
            }
        }
        this.RequestId = 'RequestId' in params ? params.RequestId : null;

    }
}

/**
 * DeadLetterPolicy
 * @class
 */
class DeadLetterPolicy extends  AbstractModel {
    constructor(){
        super();

        /**
         * DeadLetterQueueName
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {string || null}
         */
        this.DeadLetterQueueName = null;

        /**
         * DeadLetterQueue
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {string || null}
         */
        this.DeadLetterQueue = null;

        /**
         * Policy
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.Policy = null;

        /**
         * MaxTimeToLive
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.MaxTimeToLive = null;

        /**
         * MaxReceiveCount
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.MaxReceiveCount = null;

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }
        this.DeadLetterQueueName = 'DeadLetterQueueName' in params ? params.DeadLetterQueueName : null;
        this.DeadLetterQueue = 'DeadLetterQueue' in params ? params.DeadLetterQueue : null;
        this.Policy = 'Policy' in params ? params.Policy : null;
        this.MaxTimeToLive = 'MaxTimeToLive' in params ? params.MaxTimeToLive : null;
        this.MaxReceiveCount = 'MaxReceiveCount' in params ? params.MaxReceiveCount : null;

    }
}

/**
 * Filter parameter
 * @class
 */
class Filter extends  AbstractModel {
    constructor(){
        super();

        /**
         * Filter parameter name
         * @type {string || null}
         */
        this.Name = null;

        /**
         * Value
         * @type {Array.<string> || null}
         */
        this.Values = null;

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }
        this.Name = 'Name' in params ? params.Name : null;
        this.Values = 'Values' in params ? params.Values : null;

    }
}

/**
 * Field for displaying returned topic information
 * @class
 */
class TopicSet extends  AbstractModel {
    constructor(){
        super();

        /**
         * TopicId
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {string || null}
         */
        this.TopicId = null;

        /**
         * TopicName
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {string || null}
         */
        this.TopicName = null;

        /**
         * MsgRetentionSeconds
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.MsgRetentionSeconds = null;

        /**
         * MaxMsgSize
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.MaxMsgSize = null;

        /**
         * Qps
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.Qps = null;

        /**
         * FilterType
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.FilterType = null;

        /**
         * CreateTime
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.CreateTime = null;

        /**
         * LastModifyTime
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.LastModifyTime = null;

        /**
         * MsgCount
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.MsgCount = null;

        /**
         * CreateUin
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.CreateUin = null;

        /**
         * Tags
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {Array.<Tag> || null}
         */
        this.Tags = null;

        /**
         * Whether to enable message trace for a topic. true: yes, false: no
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {boolean || null}
         */
        this.Trace = null;

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }
        this.TopicId = 'TopicId' in params ? params.TopicId : null;
        this.TopicName = 'TopicName' in params ? params.TopicName : null;
        this.MsgRetentionSeconds = 'MsgRetentionSeconds' in params ? params.MsgRetentionSeconds : null;
        this.MaxMsgSize = 'MaxMsgSize' in params ? params.MaxMsgSize : null;
        this.Qps = 'Qps' in params ? params.Qps : null;
        this.FilterType = 'FilterType' in params ? params.FilterType : null;
        this.CreateTime = 'CreateTime' in params ? params.CreateTime : null;
        this.LastModifyTime = 'LastModifyTime' in params ? params.LastModifyTime : null;
        this.MsgCount = 'MsgCount' in params ? params.MsgCount : null;
        this.CreateUin = 'CreateUin' in params ? params.CreateUin : null;

        if (params.Tags) {
            this.Tags = new Array();
            for (let z in params.Tags) {
                let obj = new Tag();
                obj.deserialize(params.Tags[z]);
                this.Tags.push(obj);
            }
        }
        this.Trace = 'Trace' in params ? params.Trace : null;

    }
}

/**
 * Tag
 * @class
 */
class Tag extends  AbstractModel {
    constructor(){
        super();

        /**
         * Tag key
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {string || null}
         */
        this.TagKey = null;

        /**
         * Tag value
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {string || null}
         */
        this.TagValue = null;

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }
        this.TagKey = 'TagKey' in params ? params.TagKey : null;
        this.TagValue = 'TagValue' in params ? params.TagValue : null;

    }
}

/**
 * DescribeTopicDetail response structure.
 * @class
 */
class DescribeTopicDetailResponse extends  AbstractModel {
    constructor(){
        super();

        /**
         * TotalCount
         * @type {number || null}
         */
        this.TotalCount = null;

        /**
         * TopicSet
         * @type {Array.<TopicSet> || null}
         */
        this.TopicSet = null;

        /**
         * The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.
         * @type {string || null}
         */
        this.RequestId = null;

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }
        this.TotalCount = 'TotalCount' in params ? params.TotalCount : null;

        if (params.TopicSet) {
            this.TopicSet = new Array();
            for (let z in params.TopicSet) {
                let obj = new TopicSet();
                obj.deserialize(params.TopicSet[z]);
                this.TopicSet.push(obj);
            }
        }
        this.RequestId = 'RequestId' in params ? params.RequestId : null;

    }
}

/**
 * TransactionPolicy
 * @class
 */
class TransactionPolicy extends  AbstractModel {
    constructor(){
        super();

        /**
         * FirstQueryInterval
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.FirstQueryInterval = null;

        /**
         * MaxQueryCount
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.MaxQueryCount = null;

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }
        this.FirstQueryInterval = 'FirstQueryInterval' in params ? params.FirstQueryInterval : null;
        this.MaxQueryCount = 'MaxQueryCount' in params ? params.MaxQueryCount : null;

    }
}

/**
 * DescribeTopicDetail request structure.
 * @class
 */
class DescribeTopicDetailRequest extends  AbstractModel {
    constructor(){
        super();

        /**
         * Starting position of queue list to be returned on the current page in case of paginated return. If a value is entered, `limit` is required. If this parameter is left empty, 0 will be used by default.
         * @type {number || null}
         */
        this.Offset = null;

        /**
         * Number of queues to be returned per page in case of paginated return. If this parameter is not passed in, 20 will be used by default. Maximum value: 50.
         * @type {number || null}
         */
        this.Limit = null;

        /**
         * Currently, only filtering by `TopicName` is supported, and only one filter value can be entered
         * @type {Array.<Filter> || null}
         */
        this.Filters = null;

        /**
         * Tag match
         * @type {string || null}
         */
        this.TagKey = null;

        /**
         * Exact match by `TopicName`
         * @type {string || null}
         */
        this.TopicName = null;

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }
        this.Offset = 'Offset' in params ? params.Offset : null;
        this.Limit = 'Limit' in params ? params.Limit : null;

        if (params.Filters) {
            this.Filters = new Array();
            for (let z in params.Filters) {
                let obj = new Filter();
                obj.deserialize(params.Filters[z]);
                this.Filters.push(obj);
            }
        }
        this.TagKey = 'TagKey' in params ? params.TagKey : null;
        this.TopicName = 'TopicName' in params ? params.TopicName : null;

    }
}

/**
 * Batch queue attribute information
 * @class
 */
class QueueSet extends  AbstractModel {
    constructor(){
        super();

        /**
         * QueueId
         * @type {string || null}
         */
        this.QueueId = null;

        /**
         * QueueName
         * @type {string || null}
         */
        this.QueueName = null;

        /**
         * Qps
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.Qps = null;

        /**
         * Bps
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.Bps = null;

        /**
         * MaxDelaySeconds
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.MaxDelaySeconds = null;

        /**
         * MaxMsgHeapNum
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.MaxMsgHeapNum = null;

        /**
         * PollingWaitSeconds
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.PollingWaitSeconds = null;

        /**
         * MsgRetentionSeconds
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.MsgRetentionSeconds = null;

        /**
         * VisibilityTimeout
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.VisibilityTimeout = null;

        /**
         * MaxMsgSize
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.MaxMsgSize = null;

        /**
         * RewindSeconds
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.RewindSeconds = null;

        /**
         * CreateTime
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.CreateTime = null;

        /**
         * LastModifyTime
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.LastModifyTime = null;

        /**
         * ActiveMsgNum
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.ActiveMsgNum = null;

        /**
         * InactiveMsgNum
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.InactiveMsgNum = null;

        /**
         * DelayMsgNum
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.DelayMsgNum = null;

        /**
         * RewindMsgNum
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.RewindMsgNum = null;

        /**
         * MinMsgTime
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.MinMsgTime = null;

        /**
         * Transaction
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {boolean || null}
         */
        this.Transaction = null;

        /**
         * DeadLetterSource
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {Array.<DeadLetterSource> || null}
         */
        this.DeadLetterSource = null;

        /**
         * DeadLetterPolicy
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {DeadLetterPolicy || null}
         */
        this.DeadLetterPolicy = null;

        /**
         * TransactionPolicy
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {TransactionPolicy || null}
         */
        this.TransactionPolicy = null;

        /**
         * Creator `uin`
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {number || null}
         */
        this.CreateUin = null;

        /**
         * Tag
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {Array.<Tag> || null}
         */
        this.Tags = null;

        /**
         * Message trace flag. true: enabled, false: not enabled
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {boolean || null}
         */
        this.Trace = null;

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }
        this.QueueId = 'QueueId' in params ? params.QueueId : null;
        this.QueueName = 'QueueName' in params ? params.QueueName : null;
        this.Qps = 'Qps' in params ? params.Qps : null;
        this.Bps = 'Bps' in params ? params.Bps : null;
        this.MaxDelaySeconds = 'MaxDelaySeconds' in params ? params.MaxDelaySeconds : null;
        this.MaxMsgHeapNum = 'MaxMsgHeapNum' in params ? params.MaxMsgHeapNum : null;
        this.PollingWaitSeconds = 'PollingWaitSeconds' in params ? params.PollingWaitSeconds : null;
        this.MsgRetentionSeconds = 'MsgRetentionSeconds' in params ? params.MsgRetentionSeconds : null;
        this.VisibilityTimeout = 'VisibilityTimeout' in params ? params.VisibilityTimeout : null;
        this.MaxMsgSize = 'MaxMsgSize' in params ? params.MaxMsgSize : null;
        this.RewindSeconds = 'RewindSeconds' in params ? params.RewindSeconds : null;
        this.CreateTime = 'CreateTime' in params ? params.CreateTime : null;
        this.LastModifyTime = 'LastModifyTime' in params ? params.LastModifyTime : null;
        this.ActiveMsgNum = 'ActiveMsgNum' in params ? params.ActiveMsgNum : null;
        this.InactiveMsgNum = 'InactiveMsgNum' in params ? params.InactiveMsgNum : null;
        this.DelayMsgNum = 'DelayMsgNum' in params ? params.DelayMsgNum : null;
        this.RewindMsgNum = 'RewindMsgNum' in params ? params.RewindMsgNum : null;
        this.MinMsgTime = 'MinMsgTime' in params ? params.MinMsgTime : null;
        this.Transaction = 'Transaction' in params ? params.Transaction : null;

        if (params.DeadLetterSource) {
            this.DeadLetterSource = new Array();
            for (let z in params.DeadLetterSource) {
                let obj = new DeadLetterSource();
                obj.deserialize(params.DeadLetterSource[z]);
                this.DeadLetterSource.push(obj);
            }
        }

        if (params.DeadLetterPolicy) {
            let obj = new DeadLetterPolicy();
            obj.deserialize(params.DeadLetterPolicy)
            this.DeadLetterPolicy = obj;
        }

        if (params.TransactionPolicy) {
            let obj = new TransactionPolicy();
            obj.deserialize(params.TransactionPolicy)
            this.TransactionPolicy = obj;
        }
        this.CreateUin = 'CreateUin' in params ? params.CreateUin : null;

        if (params.Tags) {
            this.Tags = new Array();
            for (let z in params.Tags) {
                let obj = new Tag();
                obj.deserialize(params.Tags[z]);
                this.Tags.push(obj);
            }
        }
        this.Trace = 'Trace' in params ? params.Trace : null;

    }
}

/**
 * DescribeQueueDetail request structure.
 * @class
 */
class DescribeQueueDetailRequest extends  AbstractModel {
    constructor(){
        super();

        /**
         * Starting position of queue list to be returned on the current page in case of paginated return. If a value is entered, `limit` is required. If this parameter is left empty, 0 will be used by default
         * @type {number || null}
         */
        this.Offset = null;

        /**
         * Number of queues to be returned per page in case of paginated return. If this parameter is not passed in, 20 will be used by default. Maximum value: 50.
         * @type {number || null}
         */
        this.Limit = null;

        /**
         * Filter parameter. Currently, filtering by `QueueName` is supported, and only one keyword is allowed
         * @type {Array.<Filter> || null}
         */
        this.Filters = null;

        /**
         * Tag search
         * @type {string || null}
         */
        this.TagKey = null;

        /**
         * Exact match by `QueueName`
         * @type {string || null}
         */
        this.QueueName = null;

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }
        this.Offset = 'Offset' in params ? params.Offset : null;
        this.Limit = 'Limit' in params ? params.Limit : null;

        if (params.Filters) {
            this.Filters = new Array();
            for (let z in params.Filters) {
                let obj = new Filter();
                obj.deserialize(params.Filters[z]);
                this.Filters.push(obj);
            }
        }
        this.TagKey = 'TagKey' in params ? params.TagKey : null;
        this.QueueName = 'QueueName' in params ? params.QueueName : null;

    }
}

/**
 * DeadLetterSource
 * @class
 */
class DeadLetterSource extends  AbstractModel {
    constructor(){
        super();

        /**
         * QueueId
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {string || null}
         */
        this.QueueId = null;

        /**
         * QueueName
Note: this field may return null, indicating that no valid values can be obtained.
         * @type {string || null}
         */
        this.QueueName = null;

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }
        this.QueueId = 'QueueId' in params ? params.QueueId : null;
        this.QueueName = 'QueueName' in params ? params.QueueName : null;

    }
}

module.exports = {
    DescribeQueueDetailResponse: DescribeQueueDetailResponse,
    DeadLetterPolicy: DeadLetterPolicy,
    Filter: Filter,
    TopicSet: TopicSet,
    Tag: Tag,
    DescribeTopicDetailResponse: DescribeTopicDetailResponse,
    TransactionPolicy: TransactionPolicy,
    DescribeTopicDetailRequest: DescribeTopicDetailRequest,
    QueueSet: QueueSet,
    DescribeQueueDetailRequest: DescribeQueueDetailRequest,
    DeadLetterSource: DeadLetterSource,

}
